// export const TABLE_TYPE_ID_PLAN = '1'
// // 2022年数字化覆盖现状表
// export const TABLE_TYPE_ID_STATUS = '2'
// // “十四五”数字化覆盖目标表
// export const TABLE_TYPE_ID_TARGET = '3'
// // 数字化覆盖率计算表
// export const TABLE_TYPE_ID_RATE = '4'

// 数字化转型专项实施方案任务表
// =================planEditAndDetail===================
// <div class="header-btns">
//     <RPButton v-if="!disabledPage && 
//     ((fromPage == 'creater' && (dataStatus == 4|| dataStatus == 1 || dataStatus == 0)) ||
//     (fromPage == 'Summary' && dataStatus == 3))" optType="create" type="info" @click="save(1)" text="保存" />
//     <RPButton v-if="!disabledPage && fromPage == 'creater' && (dataStatus == 1 || dataStatus == 0)" optType="create" type="info" @click="save(2)" text="提交" />
//     <RPButton v-if="!disabledPage && fromPage == 'creater' && dataStatus == 4" optType="create" type="info" @click="save(2)" text="提交修改" />
//     <RPButton v-if="!disabledPage && fromPage == 'creater' && dataStatus == 2" optType="create" type="info" @click="save(1)" text="撤回提交" />
// </div>

// // 2022年数字化覆盖现状表
// // “十四五”数字化覆盖目标表
// =================CoverTargetEdit===================
// <div class="header-btns">
//     <RPButton v-if="!disabledPage && 
//     ((fromPage == 'creater' && (dataStatus == 4|| dataStatus == 1 || dataStatus == 0)) ||
//   (fromPage == 'Summary' && dataStatus == 3))" optType="create" type="info" @click="save('1')" text="保存" />
//     <RPButton v-if="!disabledPage && fromPage == 'creater' && (dataStatus == 1 || dataStatus == 0)" optType="create" type="info" @click="save('2')" text="提交" />
//     <RPButton v-if="!disabledPage && fromPage == 'creater' && dataStatus == 4" optType="create" type="info" @click="save('2')" text="提交修改" />
//     <RPButton v-if="!disabledPage && fromPage == 'creater' && dataStatus == 2" optType="create" type="info" @click="save('1')" text="撤回提交" />
// </div>
// // 数字化覆盖率计算表
// =================CoverRateEdit===================
// <div class="header-btns" >
//   <RPButton v-if="!disabledPage && 
//   ((fromPage == 'creater' && (dataStatus == 4|| dataStatus == 1 || dataStatus == 0)) ||
//   (fromPage == 'Summary' && dataStatus == 3))" optType="create" type="info" @click="save('1')" text="保存" />
//   <RPButton v-if="!disabledPage && fromPage == 'creater' && (dataStatus == 1 || dataStatus == 0)" optType="create" type="info" @click="save('2')" text="提交" />
//   <RPButton v-if="!disabledPage && fromPage == 'creater' && dataStatus == 4" optType="create" type="info" @click="save('2')" text="提交修改" />
//   <RPButton v-if="!disabledPage && fromPage == 'creater' && dataStatus == 2" optType="create" type="info" @click="save('1')" text="撤回提交" />
// </div>
import {
  PROCESS_STATUS_CREATING,
  PROCESS_STATUS_WAIT_SUBMIT,
  PROCESS_STATUS_WAIT_APPROVE,
  PROCESS_STATUS_APPROVED,
  PROCESS_STATUS_REJECTED,
} from '@/tools/common.js'

export default {
  props: {
    disabledPage: {
      type: Boolean,
      default: false
    },
    dataStatus: {
      type: Number,
      default: 0,
    },
  },
  computed: {
    // 保存
    save() {
      return !this.disabledPage && (
        (this.fromPage == 'creater' && (this.dataStatus == PROCESS_STATUS_CREATING || this.dataStatus == PROCESS_STATUS_WAIT_SUBMIT || this.dataStatus == PROCESS_STATUS_REJECTED)) ||
        (this.fromPage == 'creater' && this.dataStatus == PROCESS_STATUS_APPROVED)
      )
    },
    // 提交
    submit() {
      return !this.disabledPage && this.fromPage == 'creater' && (this.dataStatus == PROCESS_STATUS_CREATING || this.dataStatus == PROCESS_STATUS_WAIT_SUBMIT);
    },
    // 提交修改
    modify() {
      return !this.disabledPage && this.fromPage == 'creater' && this.dataStatus == PROCESS_STATUS_REJECTED;
    },
    // 撤回提交
    withdraw() {
      return !this.disabledPage && this.fromPage == 'creater' && this.dataStatus == PROCESS_STATUS_WAIT_APPROVE;
    },
    // 通过
    approve() {
      return this.fromPage == 'Approver' && this.dataStatus == PROCESS_STATUS_WAIT_APPROVE;
    },
    // 驳回
    reject() {
      return this.fromPage == 'Approver' && this.dataStatus == PROCESS_STATUS_WAIT_APPROVE;
    },
  }
};
